import fetch from 'utils/fetch';


// 学校的模糊搜索，根据学校名称查询学校
export function getSchoolListBySchoolName(schoolName) {
    const data = {
        schoolName
    };
    return fetch({
        url: '/cookbook/querySchoolByName',
        method: 'post',
        data
    })
}


// 课程统计数据
export function getStatisticalData(){
    return fetch({
        url: '/course/totalCount',
        method: 'post'
    });
}

// 查询
export function getLessonListByParams(page,rows,schoolId,provinceId, cityId, areaId, title,status, startTime, expectEndtime){
    const data = {
        page,
        rows,
        schoolId,
        provinceId,
        cityId, 
        areaId,
        title, 
        status, 
        startTime, 
        expectEndtime
    };
    return fetch({
        url: '/course/getCourseByPage',
        method: 'post',
        data,
    });
}


// 评论查询
export function getCommentListByParams(id,userName,page,rows,xiaoxinCode,commentContent,commentStartTime,commentEndTime){
    const data = {
        id,
        userName,
        page,
        rows,
        xiaoxinCode,
        commentContent,
        commentStartTime,
        commentEndTime
    };
    return fetch({
        url: '/course/pageComment',
        method: 'post',
        data,
    });
}

// 结束课程
export function stopLessonByLessonId(id,reason){
    const data = {
        id,
        reason
    };
    return fetch({
        url: '/course/stopCourse',
        method: 'post',
        data,
    });
}

// 查看课程详情
export function getLessonDetailByLessonId(id){
    const data = {
        id
    };
    return fetch({
        url: '/course/selectByPid',
        method: 'post',
        data,
    });

}


